package com.shuoyue.ycgk.ui.pay;

import android.text.TextUtils;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseViewHolder;
import com.shuoyue.ycgk.R;
import com.shuoyue.ycgk.base.baseadapter.AppBaseQuickAdapter;
import com.shuoyue.ycgk.utils.GlideUtil;

import java.util.List;

public class PreGoodsAdapter extends AppBaseQuickAdapter<GoodsItem> {


    public PreGoodsAdapter(@Nullable List<GoodsItem> data) {
        super(R.layout.item_preorder_goods, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GoodsItem item) {
        helper.setText(R.id.title, item.getTitle());
        helper.setText(R.id.price, "￥" + item.getPrice() );//((item.getPrice() % 1f == 0) ? ((int) item.getPrice()) : item.getPrice())
        helper.setText(R.id.info, item.getInfo());
        helper.setGone(R.id.cover, !TextUtils.isEmpty(item.getCover()));

        if (!TextUtils.isEmpty(item.getCover())) {
            GlideUtil.loadImage(mContext, item.getCover(), R.mipmap.img_loading_gray, helper.getView(R.id.cover));
        }

    }
}
